package world.snowcrystal.manager;

import com.aliyun.oss.OSS;
import com.aliyun.oss.model.PutObjectResult;
import org.springframework.stereotype.Component;
import world.snowcrystal.properties.OssProperties;

import javax.annotation.Resource;
import java.io.File;

@Component
public class OssManager {
    @Resource
    private OSS ossClient;

    @Resource
    private OssProperties ossProperties;

        public PutObjectResult putObject(String key, String localFilePath){
            return ossClient.putObject(ossProperties.getBucketName(),key,new File(localFilePath));
        }
        public PutObjectResult putObject(String key, File file){
            return ossClient.putObject(ossProperties.getBucketName(),key,file);
        }

}
